roundedbox: Remove unused API
authorBenjamin Otte <otte@redhat.com>
Wed, 2 Dec 2020 07:50:16 +0000 (08:50 +0100)
committerBenjamin Otte <otte@redhat.com>
Thu, 24 Dec 2020 05:38:45 +0000 (06:38 +0100)
gtk/gtkroundedbox.c
gtk/gtkroundedboxprivate.h

index c068c8587d9de84b13d5a320ded3b55b20d248e2..9ea67825734986d5299f91db12c151d98d5dc96d 100644 (file)
 
 #include <string.h>
 
-/**
- * _gtk_rounded_box_init_rect:
- * @box: box to initialize
- * @x: x coordinate of box
- * @y: y coordinate of box
- * @width: width of box
- * @height: height of box
- *
- * Initializes the given @box to represent the given rectangle.
- * The
- **/
-void
-_gtk_rounded_box_init_rect (GskRoundedRect *box,
-                            double          x,
-                            double          y,
-                            double          width,
-                            double          height)
-{
-  memset (box, 0, sizeof (GskRoundedRect));
-
-  box->bounds.origin.x = x;
-  box->bounds.origin.y = y;
-  box->bounds.size.width = width;
-  box->bounds.size.height = height;
-}
-
-/* clamp border radius, following CSS specs */
-static void
-gtk_rounded_box_clamp_border_radius (GskRoundedRect *box)
-{
-  double factor = 1.0;
-  double corners;
-
-  corners = box->corner[GSK_CORNER_TOP_LEFT].width + box->corner[GSK_CORNER_TOP_RIGHT].width;
-  if (corners != 0)
-    factor = MIN (factor, box->bounds.size.width / corners);
-
-  corners = box->corner[GSK_CORNER_TOP_RIGHT].height + box->corner[GSK_CORNER_BOTTOM_RIGHT].height;
-  if (corners != 0)
-    factor = MIN (factor, box->bounds.size.height / corners);
-
-  corners = box->corner[GSK_CORNER_BOTTOM_RIGHT].width + box->corner[GSK_CORNER_BOTTOM_LEFT].width;
-  if (corners != 0)
-    factor = MIN (factor, box->bounds.size.width / corners);
-
-  corners = box->corner[GSK_CORNER_TOP_LEFT].height + box->corner[GSK_CORNER_BOTTOM_LEFT].height;
-  if (corners != 0)
-    factor = MIN (factor, box->bounds.size.height / corners);
-
-  box->corner[GSK_CORNER_TOP_LEFT].width *= factor;
-  box->corner[GSK_CORNER_TOP_LEFT].height *= factor;
-  box->corner[GSK_CORNER_TOP_RIGHT].width *= factor;
-  box->corner[GSK_CORNER_TOP_RIGHT].height *= factor;
-  box->corner[GSK_CORNER_BOTTOM_RIGHT].width *= factor;
-  box->corner[GSK_CORNER_BOTTOM_RIGHT].height *= factor;
-  box->corner[GSK_CORNER_BOTTOM_LEFT].width *= factor;
-  box->corner[GSK_CORNER_BOTTOM_LEFT].height *= factor;
-}
-
-static void
-_gtk_rounded_box_apply_border_radius (GskRoundedRect *box,
-                                      const GtkCssValue * const corner[4])
-{
-  box->corner[GSK_CORNER_TOP_LEFT].width = _gtk_css_corner_value_get_x (corner[GSK_CORNER_TOP_LEFT],
-                                                                          box->bounds.size.width);
-  box->corner[GSK_CORNER_TOP_LEFT].height = _gtk_css_corner_value_get_y (corner[GSK_CORNER_TOP_LEFT],
-                                                                        box->bounds.size.height);
-
-  box->corner[GSK_CORNER_TOP_RIGHT].width = _gtk_css_corner_value_get_x (corner[GSK_CORNER_TOP_RIGHT],
-                                                                           box->bounds.size.width);
-  box->corner[GSK_CORNER_TOP_RIGHT].height = _gtk_css_corner_value_get_y (corner[GSK_CORNER_TOP_RIGHT],
-                                                                         box->bounds.size.height);
-
-  box->corner[GSK_CORNER_BOTTOM_RIGHT].width = _gtk_css_corner_value_get_x (corner[GSK_CORNER_BOTTOM_RIGHT],
-                                                                              box->bounds.size.width);
-  box->corner[GSK_CORNER_BOTTOM_RIGHT].height = _gtk_css_corner_value_get_y (corner[GSK_CORNER_BOTTOM_RIGHT],
-                                                                            box->bounds.size.height);
-
-  box->corner[GSK_CORNER_BOTTOM_LEFT].width = _gtk_css_corner_value_get_x (corner[GSK_CORNER_BOTTOM_LEFT],
-                                                                             box->bounds.size.width);
-  box->corner[GSK_CORNER_BOTTOM_LEFT].height = _gtk_css_corner_value_get_y (corner[GSK_CORNER_BOTTOM_LEFT],
-                                                                           box->bounds.size.height);
-
-  gtk_rounded_box_clamp_border_radius (box);
-}
-
-void
-gtk_rounded_boxes_init_for_style (GskRoundedRect *border_box,
-                                  GskRoundedRect *padding_box,
-                                  GskRoundedRect *content_box,
-                                  GtkCssStyle    *style,
-                                  double          x,
-                                  double          y,
-                                  double          width,
-                                  double          height)
-{
-  const GtkCssValue *corner[4];
-  GskRoundedRect box;
-
-  gsk_rounded_rect_init_from_rect (&box, &GRAPHENE_RECT_INIT (x, y, width, height), 0);
-
-  corner[GSK_CORNER_TOP_LEFT] = style->border->border_top_left_radius;
-  corner[GSK_CORNER_TOP_RIGHT] = style->border->border_top_right_radius;
-  corner[GSK_CORNER_BOTTOM_LEFT] = style->border->border_bottom_left_radius;
-  corner[GSK_CORNER_BOTTOM_RIGHT] = style->border->border_bottom_right_radius;
-
-  _gtk_rounded_box_apply_border_radius (&box, corner);
-
-  if (border_box)
-    gsk_rounded_rect_init_copy (border_box, &box);
-
-  if (padding_box || content_box)
-    {
-      gsk_rounded_rect_shrink (&box,
-                               _gtk_css_number_value_get (style->border->border_top_width, 100),
-                               _gtk_css_number_value_get (style->border->border_right_width, 100),
-                               _gtk_css_number_value_get (style->border->border_bottom_width, 100),
-                               _gtk_css_number_value_get (style->border->border_left_width, 100));
-      if (padding_box)
-        gsk_rounded_rect_init_copy (padding_box, &box);
-
-      if (content_box)
-        {
-          gsk_rounded_rect_shrink (&box,
-                                   _gtk_css_number_value_get (style->size->padding_top, 100),
-                                   _gtk_css_number_value_get (style->size->padding_right, 100),
-                                   _gtk_css_number_value_get (style->size->padding_bottom, 100),
-                                   _gtk_css_number_value_get (style->size->padding_left, 100));
-          gsk_rounded_rect_init_copy (content_box, &box);
-        }
-    }
-}
-
 typedef struct {
   double angle1;
   double angle2;
@@ -591,12 +458,3 @@ _gtk_rounded_box_path_left (const GskRoundedRect *outer,
   cairo_close_path (cr);
 }
 
-void
-_gtk_rounded_box_clip_path (const GskRoundedRect *box,
-                            cairo_t              *cr)
-{
-  cairo_rectangle (cr,
-                   box->bounds.origin.x, box->bounds.origin.y,
-                   box->bounds.size.width, box->bounds.size.height);
-}
-
index 4bf2c2fb721b213db3adacccbdbe13527c500056..208d30c3026c0f46f5189042412eeba0633aac98 100644 (file)
 
 G_BEGIN_DECLS
 
-void            _gtk_rounded_box_init_rect                      (GskRoundedRect         *box,
-                                                                 double                  x,
-                                                                 double                  y,
-                                                                 double                  width,
-                                                                 double                  height);
-void            gtk_rounded_boxes_init_for_style                (GskRoundedRect         *border_box,
-                                                                 GskRoundedRect         *padding_box,
-                                                                 GskRoundedRect         *content_box,
-                                                                 GtkCssStyle            *style,
-                                                                 double                  x,
-                                                                 double                  y,
-                                                                 double                  width,
-                                                                 double                  height);
-
 double          _gtk_rounded_box_guess_length                   (const GskRoundedRect   *box,
                                                                  GtkCssSide              side);
 
@@ -60,8 +46,6 @@ void            _gtk_rounded_box_path_bottom                    (const GskRounde
 void            _gtk_rounded_box_path_left                      (const GskRoundedRect   *outer,
                                                                  const GskRoundedRect   *inner,
                                                                  cairo_t                *cr);
-void            _gtk_rounded_box_clip_path                      (const GskRoundedRect   *box,
-                                                                 cairo_t                *cr);
 
 G_END_DECLS